package com.ruoyi.hqfinance.service.impl;

import com.github.pagehelper.PageHelper;
import com.ruoyi.common.utils.StringUtils;
import com.ruoyi.hqfinance.domain.HqCollectPaiFeeByChannel;
import com.ruoyi.hqfinance.domain.vo.HqCollectPaiFeeByChannelVo;
import com.ruoyi.hqfinance.mapper.HqCollectPaiFeeByChannelMapper;
import com.ruoyi.hqfinance.service.HqCollectPaiFeeByChannelService;
import com.sun.corba.se.spi.ior.IdentifiableFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;
@Service
public class HqCollectPaiFeeByChannelServiceImpl implements HqCollectPaiFeeByChannelService {
    @Autowired
    private HqCollectPaiFeeByChannelMapper hqCollectPaiFeeByChannelMapper;
    @Override
    public List<HqCollectPaiFeeByChannel> collectPaiFeeByChannel(HqCollectPaiFeeByChannelVo hqCollectPaiFeeByChannelVo) {
        PageHelper.startPage(hqCollectPaiFeeByChannelVo.getPageDate());
        List<HqCollectPaiFeeByChannel> collectPaiFeeByChannels = hqCollectPaiFeeByChannelMapper.collectPaiFeeByChannel(hqCollectPaiFeeByChannelVo);
        assert collectPaiFeeByChannels != null;
        for (HqCollectPaiFeeByChannel hqCollectPaiFeeByChannel : collectPaiFeeByChannels){
            if (hqCollectPaiFeeByChannelVo.getCollectType() != null) {
                if (hqCollectPaiFeeByChannelVo.getCollectType() == 2) {
                    hqCollectPaiFeeByChannel.setDate(hqCollectPaiFeeByChannelVo.getStartTime() + "至" + hqCollectPaiFeeByChannelVo.getEndTime());
                }
            }
        }
        return collectPaiFeeByChannels;
    }
}
